[MIRROR] Makes it EVEN EASIER to work with atom item interactions ft. "Leaf and Branch" & "Death to Chains" #2958
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mirrored on Nova: NovaSector/NovaSector#2053
Original PR: tgstation/tgstation#82625
About The Pull Request
When I made the new item interaction chain, I did this pattern for items interacting with atoms:
https://github.com/tgstation/tgstation/blob/d2956ae821c6a865d8ee3de0d4b92979a9d08e32/code/game/atom/atom_tool_acts.dm#L85-L86
This is VERY clean and makes it ridiculously easy to add item-to-atom interactions without worry about needing to fuss around with calling parent and checking parent return value, IE, dealing with the dreaded chain.
Of course for some reason when I did this I didn't do the same for atom-from-item interactions themselves, relying on people call parent and check for blockers. Which worked in my head but is not easy to pick up as a new contributor.
So here we are, hopefully the final version of the atom-item-non-combat-interact chain.
Base
item_interaction
that handles all the signals and calling relevant procs is nowbase_item_interaction
item_interaction
is now a stub proc that atoms can override at whim without worrying about parent calls (unless subtypes implement it).This results in MUCH cleaner and easier to work with code.
And as an added bonus, it's (technically) completely backwards compatible with existing code. I changed it just for posterity but for downstreams and such, they don't even need to change anything, and it'll work as it did before.
Changelog
🆑 Melbert
refactor: Atom-Item interactions have been refactored once more. Report any oddities.
/:cl: